#ifndef MESSAGE_H
#define MESSAGE_H

#include <iostream>
#include <sys/types.h>
#include <sys/msg.h>
#include <sys/ipc.h>

using namespace std;

class IMessage {
public:
	virtual int getLength() = 0;
	virtual void* getBuffer() = 0;
	virtual void setBuffer(void* , int size) = 0;
	virtual long getMessageType() = 0;
};

class MessageChannel {
public:
	/**
	 * CTOR, create clear channel
	 * */
	MessageChannel(key_t pKey);
	
	///DTOR
	~MessageChannel();
	
	int send(IMessage* pMessage);
	int receive(IMessage* pMessage, int pSize);
	int getId();
	
	bool isOpen;
	
private:
	key_t mKey;
	int mId;
};

#endif
